package com.xbongbong.paas.controller;/*/*/

import com.alibaba.fastjson.JSON;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.XbbResponse;
import com.xbongbong.pro.constant.XbbProConstant;
import com.xbongbong.pro.enums.errorcodes.SystemErrorCodeEnum;
import com.xbongbong.pro.message.pojo.dto.ConsistencySyncRabbitMqDTO;
import com.xbongbong.pro.message.pojo.vo.ConsistencySyncRabbitMqVO;
import com.xbongbong.saas.service.ConsistencySyncService;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Objects;

/**
 * 数据一致性同步 controller
 * @author 魏荣杰
 * @date 2019/6/11 10:51
 * @since v1.0
 * @version v1.0
 */
@RestController
@RequestMapping(XbbProConstant.API_ROOT_PREFIX + "/dataConsistency")
public class ConsistencySyncRabbitMqController {

    @Resource
    private ConsistencySyncService consistencySyncService;
    
    /**
     * Description: 客户数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author 魏荣杰
     * @date 2019/6/11 10:57
     * @since v1.0
     */
    @RequestMapping(value = "/customer", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncCustomer(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncCustomer(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 联系人 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author 魏荣杰
     * @date 2019/6/11 10:57
     * @since v1.0
     */
    @RequestMapping(value = "/contact", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncContact(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncContact(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 合同 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author 魏荣杰
     * @date 2019/6/11 10:57
     * @since v1.0
     */
    @RequestMapping(value = "/contract", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncContract(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncContract(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 机会 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author 魏荣杰
     * @date 2019/6/11 10:57
     * @since v1.0
     */
    @RequestMapping(value = "/opportunity", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncOpportunity(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncOpportunity(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }


    /**
     * Description: 产品 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author 魏荣杰
     * @date 2019/6/11 10:57
     * @since v1.0
     */
    @RequestMapping(value = "/product", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncProduct(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncProduct(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 用户 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author 魏荣杰
     * @date 2019/6/11 10:57
     * @since v1.0
     */
    @RequestMapping(value = "/user", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncUser(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncUser(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 供应商 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author 吴峰
     * @date 2019/6/20 10:47
     * @since v1.0
     */
    @RequestMapping(value = "/supplier", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncSupplier(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncSupplier(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 仓库 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author 魏荣杰
     * @date 2019/8/5 9:37
     * @since v1.0
     */
    @RequestMapping(value = "/warehouse", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncWarehouse(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncWarehouse(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 报价单 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author long.rao
     * @date 2019-09-10 15:25
     */
    @RequestMapping(value = "/quotation", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncQuotation(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncQuotation(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 采购合同 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author jyh
     * @date 2019-11-27 15:04
     */
    @RequestMapping(value = "/purchase", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncPurchase(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncPurchase(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 批次流水 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author jyh
     * @date 2019-11-27 15:04
     */
    @RequestMapping(value = "/batchFlowBill", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncBatchFlowBill(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncBatchFlowBill(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 序列号 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author jyh
     * @date 2019-11-27 15:04
     */
    @RequestMapping(value = "/seqSearch", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncSeqSearch(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncSeqSearch(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 应收款 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author jyh
     * @date 2019-11-27 15:04
     */
    @RequestMapping(value = "/payment", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncPayment(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncPayment(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 付款计划 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     * @author jyh
     * @date 2019-11-27 15:04
     */
    @RequestMapping(value = "/payPlan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncPayPlan(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncPayPlan(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 市场活动 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     */
    @RequestMapping(value = "/marketActivity", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncMarketActivity(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncMarketActivity(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 线索 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     */
    @RequestMapping(value = "/clue", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncClueActivity(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncClue(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 竞争对手 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     */
    @RequestMapping(value = "/competitor", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncCompetitor(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncCompetitor(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 销项发票 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     */
    @RequestMapping(value = "/invoice", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncInvoice(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncInvoice(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }

    /**
     * Description: 销售出库单 数据一致性更新
     * @param consistencySyncRabbitMqDTO
     * @param br
     * @return java.lang.String
     * @throws Exception Exception
     */
    @RequestMapping(value = "/contractOutStock", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String syncContractOutStock(@RequestBody @Valid ConsistencySyncRabbitMqDTO consistencySyncRabbitMqDTO, BindingResult br) throws Exception{
        XbbResponse<ConsistencySyncRabbitMqVO> response;
        if (br.hasErrors()) {
            String errMsg = Objects.requireNonNull(br.getFieldError()).getDefaultMessage();
            response = new XbbResponse<>(SystemErrorCodeEnum.API_ERROR_100002, errMsg);
        } else {
            try {
                consistencySyncService.syncContractOutStock(consistencySyncRabbitMqDTO);
                ConsistencySyncRabbitMqVO consistencySyncRabbitMqVO = new ConsistencySyncRabbitMqVO();
                response = new XbbResponse<>(consistencySyncRabbitMqVO);
            } catch (XbbException e) {
                response = new XbbResponse<>(e);
            }
        }
        return JSON.toJSONString(response);
    }
}
